package chap3_10;

import java.util.Scanner;

public class Exer3_10_5 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("请输入三角形的高：");
        int h = 0;
        while (true) {
            h = input.nextInt();
            if (h > 0) {
                break;
            }
            System.out.println("输错了，请重新输入：");
        }
        for (int i = 1; i <= h; i++) {
            for (int j = 1; j <= 2 * h - 1; j++) {
                if((i==h+1-j)||(i==j-(h-1))||(i==h)) {
                    System.out.print("*");
                }else{
                    System.out.print(" ");
                }
            }
            System.out.println();
        }
    }
}
